import React, { Component } from 'react'
import { Link, Route, Switch, Redirect } from 'react-router-dom'
// import Home from './commonents/home'
// import List from './commonents/list'
// import NotFound from './commonents/notFound'
// import auth from './commonents/auth'
import AuthRouterGuard from './commonents/guard'
import loadComponent from '@loadable/component'
import { withRouter } from 'react-router-dom'

const Home = loadComponent( () => import('./commonents/home'))
const List = loadComponent( () => import('./commonents/list'))
const NotFound = loadComponent( () => import('./commonents/notFound'))
const auth = loadComponent( () => import('./commonents/auth'))

class App extends Component {
  render() {
    return (
      <div className="App">
        <div>
          <Link to="/home">首页</Link>----
          <Link to="/list">列表</Link>----
        </div>
        <div>
          <Switch>
            <Route path="/" component={Home} exact />
            <Route path="/home" component={Home} />
            <AuthRouterGuard path="/list" Component={ List } />
            {/* <Route path="/list" component={ List }/> */}
            <Route component={NotFound} />
          </Switch>
        </div>
      </div>
    );
  }
}

export default App;
